package cn.iocoder.yudao.module.biz.dal.mysql.htPlanExe;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.biz.dal.dataobject.htPlanExe.HtPlanExeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.biz.controller.admin.htPlanExe.vo.*;
import org.apache.ibatis.annotations.Param;

/**
 * 排查计划执行任务 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface HtPlanExeMapper extends BaseMapperX<HtPlanExeDO> {

    default PageResult<HtPlanExeDO> selectPage(HtPlanExePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<HtPlanExeDO>()
//                .eqIfPresent(HtPlanExeDO::getPlanId, reqVO.getPlanId())
//                .betweenIfPresent(HtPlanExeDO::getStartTime, reqVO.getBeginStartTime(), reqVO.getEndStartTime())
//                .betweenIfPresent(HtPlanExeDO::getEndTime, reqVO.getBeginEndTime(), reqVO.getEndEndTime())
//                .betweenIfPresent(HtPlanExeDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(HtPlanExeDO::getId));
    }

    default List<HtPlanExeDO> selectList(HtPlanExeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<HtPlanExeDO>()
                .eqIfPresent(HtPlanExeDO::getPlanId, reqVO.getPlanId())
                .betweenIfPresent(HtPlanExeDO::getStartTime, reqVO.getBeginStartTime(), reqVO.getEndStartTime())
                .betweenIfPresent(HtPlanExeDO::getEndTime, reqVO.getBeginEndTime(), reqVO.getEndEndTime())
                .betweenIfPresent(HtPlanExeDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .orderByDesc(HtPlanExeDO::getId));
    }

    Integer countPlanExe(Map<String, Object> map);

    List<HtPlanExeJoinPageVO> selectHtPlanExePage(HtPlanExePageReqVO pageVO);

    Integer selectHtPlanExePageCount(HtPlanExePageReqVO pageVO);

    int countDifference(@Param("planId") String planId, @Param("planExeId") String planExeId);

    int countPlanExeState(@Param("planId") String planId,@Param("planExeId") String planExeId);

    List<String> getOssIds(@Param("planDetailExeId")String planDetailExeId);
}
